<template>
  <div class="editBank-page">
    <div class="content">
      <div class="form-item">
        <div class="iconBox">
          姓名
        </div>
        <input type="text" name="" class="input-control" placeholder="请开户名称" id="mobilePhone" v-model="name">
      </div>
      <div class="line"></div>
      <div class="form-item">
        <div class="iconBox">
          开户行
        </div>
        <input type="text" name="" class="input-control" placeholder="请开户行" id="mobilePhone" v-model="bankname">
      </div>
      <div class="line"></div>
      <div class="form-item">
        <div class="iconBox">
          开户行账号
        </div>
        <input type="number" name="" class="input-control" placeholder="请输入新密码" id="password" v-model="number">
      </div>
    </div>
    <div class="footer" id="loginBtn" @click='submit'>
      <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/12-28_1.png" class="login-image">
    </div>
  </div>
</template>
<script>
import { wxshare } from 'common/mixin'
import { mapActions } from 'vuex'
import { Toast } from 'mint-ui';
import { checkZhName, checkBankNum } from 'common/utils'

export default {
  mixins: [wxshare],
  data() {
    return {
      name: '',
      bankname: '',
      number: '',
    }
  },

  methods: {
    ...mapActions({
      updatePassword: 'updatePassword',
      getInfo: 'GetInfo'
    }),
    goregister() {
      this.$router.push({ path: 'register' });
    },
    submit() {
      if (!checkZhName(this.name)) {
        Toast('请填写正确开户名称 ！');
        return false;
      }
      if (!(this.bankname)) {
        Toast('请填写正确开户行名称');
        return false;
      }
      if (!checkBankNum(this.password)) {
        Toast('请填写正确银行账号');
        return false;
      }

      this.updatePassword({ phone: this.phone, password: this.password, oldPassword: this.oldPassword, affirmPassword: this.affirmPassword }).then(result => {
        this.getInfo().then(data => {
          this.$router.push("/channel/home");
        })
      }).catch(msg => {
        Toast(msg);
      })
    }
  }
}

</script>
<style lang="less">
.editBank-page {

  .background-image {
    width: 100%;
    height: 4rem
  }

  .image-buy {
    margin-top: -4rem;
    margin-left: auto;
    margin-right: auto;
    width: 17rem;
  }

  .content-image {
    width: 100%;
    height: 6.45rem
  }

  .content {
    width: 100%;
    height: 12.3rem;
    background: #FFFFFF;
    box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.10);
    margin-top: 0.75rem;
    margin-left: auto;
    margin-right: auto
  }

  .form-item {
    width: 100%;
    height: 3rem;
    margin-bottom: 0rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .iconBox {
    margin-left: 0.5rem;
    width: 7rem;
    font-family: PingFangSC-Regular;
    font-size: 16px;
    color: rgba(32, 67, 106, 0.40);
  }

  .icon-name {
    width: 0.8rem;
    height: 0.8rem;
  }

  .input-control {
    width: 100%;
    height: 90%;
    padding-left: 0.8rem;
    outline: none;
    font-size: 0.9rem;
    font-family: PingFangSC-Regular;
    color: #20436A;
  }

  .line {
    height: 1px;
    width: 100%;
    background: rgba(0, 0, 0, 0.10);
  }

  .footer {
    margin-top: 3rem;
    text-align: center;
  }

  .login-image {
    width: 15rem;
    height: 3.75rem;
  }
  .reg {
    width: 80%;
    margin: 0 auto;
    text-align: right;
  }

  .reg_content {
    color: #009cde;
    font-size: 0.8rem;
    font-family: "微软雅黑";
  }
}

</style>
